#include<iostream>
#include<cmath>

struct rect
{
    double x;
    double y;
};

struct polar
{
    double distance;
    double angle;
};

void show_polar(polar p);
polar rect_to_polar(rect r);

void show_polar(polar* p);
void rect_to_polar(const rect *r,polar* p);


int main()
{
    using namespace std;
    rect rplace;
    polar pplace;
    cout << "input the x and y values:" << endl;
    while(cin >> rplace.x >> rplace.y)
    {
        // pplace = rect_to_polar(rplace);
        // show_polar(pplace);
        // cout << "Next two numbers(q to quit)" << endl;
        rect_to_polar(&rplace,&pplace);
        show_polar(&pplace);
    }

    cout << "done\n";


    return 0;
}

void show_polar(polar p)
{
    using namespace std;
    const double rad_to_reg = 57.29577951;

    cout << "distance: " << p.distance << endl;
    cout << "angle: " << p.angle*rad_to_reg << endl;
    cout << "degrees" << endl;

}

polar rect_to_polar(rect r)
{
    polar ans;
    ans.distance = sqrt((r.x*r.x)+(r.y*r.y));
    ans.angle = atan2(r.y,r.x);
    return ans;
}



void show_polar(polar* p)
{
    using namespace std;
    const double rad_to_reg = 57.29577951;

    cout << "distance: " << p->distance << endl;
    cout << "angle: " << p->angle*rad_to_reg << endl;
    cout << "degrees" << endl;

}
void rect_to_polar(const rect *r,polar* p)
{
    p->distance = sqrt(r->x * r->x + r->y*r->y);
    p->angle = atan2(r->y, r->x);

}